//
//  QGHelpPageModel.m
//  QuanGou
//
//  Created by qqqq on 15/11/20.
//  Copyright © 2015年 DongYongFei. All rights reserved.
//

#import "QGHelpPageModel.h"
#import <AVFile.h>

@interface QGHelpPageModel ()

@property (nonatomic,strong) NSDateFormatter *formatter;
@end
@implementation QGHelpPageModel

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"picture"]) {
        if (value) {
            AVFile *imageFile = value;
            self.pictureOfSend = imageFile.url;
            
        }
    }else if([key isEqualToString:@"creteTime"]) {
        self.creatTime = [self.formatter stringFromDate:value];
        NSDate *nowDate = [NSDate date];
        double time = [nowDate timeIntervalSince1970] - [value timeIntervalSince1970];
        self.time = [NSString stringWithFormat:@"%f",time];
    }
}
- (NSDateFormatter *)formatter {
    if (!_formatter) {
        _formatter = [[NSDateFormatter alloc] init];
        _formatter.dateFormat = @"yyyy-MM-dd HH:mm";
    }
    return _formatter;
}
@end
